package com.xudow.app.ui;

import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.PopupWindow;
import android.widget.TextView;

import com.activeshare.edu.ucenter.models.vo.ScheduleVO;
import com.xudow.app.R;

/**
 * 课表详情弹出框
 *
 * @author lukecheng
 */
public class ClazzScheduleDetailPopupWindow extends PopupWindow {

    private View contentView;

    public ClazzScheduleDetailPopupWindow(Context context, ScheduleVO scheduleVO) {
        super(context);

        LayoutInflater inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        contentView = inflater.inflate(R.layout.layout_class_schedule_detail, null);

        setContentView(contentView);

        setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
        setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);

        ColorDrawable dw = new ColorDrawable(Color.WHITE);
        setBackgroundDrawable(dw);

        setOutsideTouchable(true);

        ((TextView) contentView.findViewById(R.id.scheduleInfo)).setText(scheduleVO.getScheduleInfo());
        ((TextView) contentView.findViewById(R.id.week)).setText("(" + scheduleVO.getWeek() + ")");
        ((TextView) contentView.findViewById(R.id.date)).setText(scheduleVO.getDate());
        ((TextView) contentView.findViewById(R.id.times)).setText(scheduleVO.getTimes());
        ((TextView) contentView.findViewById(R.id.groupName)).setText(scheduleVO.getGroupName());
        ((TextView) contentView.findViewById(R.id.classRoom)).setText(scheduleVO.getClassRoom());

        contentView.findViewById(R.id.back).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
    }
}
